//
//  HPContenTVCell.m
//  hnGovernment
//
//  Created by 安仔 on 17/2/28.
//  Copyright © 2017年 安仔. All rights reserved.
//

#import "HPContenTVCell.h"
#import "HPContentView.h"
#import "DTExhibitionModel.h"
@interface HPContenTVCell ()<HPContentViewDelegate>
//覆盖在整个cell上面的view
@property(nonatomic, strong) HPContentView *cellView;
@end

@implementation HPContenTVCell

- (void)layoutSubviews {
    [super layoutSubviews];
    [self initCellViewWithSize:self.bounds.size];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier Size:(CGSize)size {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
//        [self initCellViewWithSize:size];
    }
    return self;
}

//初始化 cellView
- (void) initCellViewWithSize:(CGSize)size {
//    _cellView = [[HPContentView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
    _cellView.frame = CGRectMake(0, 0, size.width, size.height);
    _cellView.delegate = self;
    [self.contentView addSubview:_cellView];
}

-(void)collectionClick:(NSInteger)item {
    [self.delegate cellClickCollectionItem:self andItem:item];
}

- (void) setCellData:(NSArray *)cellArray withSection:(NSInteger ) section{
    DTExhibitionModel *obj = cellArray[section];
    NSArray *dataArr = obj.exhibitionService;
    [self.cellView setData:dataArr headerString:obj.exhibitionName];
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (HPContentView *)cellView {
    if (_cellView == nil) {
        _cellView = [[HPContentView alloc]init];
    }
    return _cellView;
}

@end
